<?php
include_once('class/autoload.php'); // pour inclure nos classes
include_once('class/config.inc.php');
$site = new page_securisee('accueil');
if (utilCoTypeC($_SESSION['identifiant']) == 1){
//Si on a cliqué sur 'supprimer licence', on supprime la licence sélectionnée
if(isset($_POST['typeLic'])){
	supp_licence($_POST['typeLic']);
}
//Si on a cliqué sur 'ajouter une licence', et que l'ID et le libellé de licence sont completés, on ajoute la licence
else if(isset($_POST['idLic']) && isset($_POST['libelleLic'])){
	add_licence($_POST['idLic'], $_POST['libelleLic']);
}
$site->corps = 
'<h2 class="form-signin-heading">Gestion des types de licences</h2>
		<div class="table-responsive">
  			<table class="table table-striped">
  				<thead>
  					<tr>
  						<th>ID</th>
  						<th>D&eacutenomination</th>
  						<th>&nbsp;</th>
  					</tr>
  				</thead>
  				<tbody>
  					<tr>
  						<form class="form-signin" method="post" Action="gestTypes.php">
							<td class="input-id-gestTypes"><input type="text" placeholder="ID licence" id="idLic" name="idLic"></td>
							<td><input type="text" placeholder="D&eacute;nomination de la licence" id="libelleLic" name="libelleLic"></td>
							<td><button type="submit" class="btn btn-success">Ajouter</button></a></td>
						</form>
  					</tr>
  				</tbody>
		</div>
		<div class="table-responsive">
  			</table>
			<br /><br />
        	<table class="table table-striped">
	        	<thead>
	        		<tr>
	        			<th>#</th>
	        			<th>Types de licences disponible :</th>
	        			<th>&nbsp;</th>
	        		</tr>
	        	</thead>
	        	<tbody>
	        		'.gest_licences().'	        	
				</tbody>
  			</table>
	     </div>';
}
else{
	$site->corps = 'Vous ne pouvez pas acc&eacuteder &agrave cette page.';
}
$site->affiche();
?>